<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=1000, initial-scale=1.0, maximum-scale=1.0">
	    <!-- Loading Bootstrap -->
	    <link href="http://localhost/YouHuoShop/Static/Admin/Flat/dist/css/vendor/bootstrap.min.css" rel="stylesheet">
	    <!-- Loading Flat UI -->
	    <link href="http://localhost/YouHuoShop/Static/Admin/Flat/dist/css/flat-ui.css" rel="stylesheet">
	    <link href="http://localhost/YouHuoShop/Static/Admin/Flat/docs/assets/css/demo.css" rel="stylesheet">
	    <link rel="shortcut icon" href="http://localhost/YouHuoShop/Static/Admin/Flat/img/favicon.ico">
	    <script type="text/javascript" src="http://localhost/YouHuoShop/Static/uploadify/jquery-1.8.2.min.js"></script>
		<script type="text/javascript" src="http://localhost/YouHuoShop/Static/uploadify/jquery.uploadify.min.js"></script>	
	    <link href="http://localhost/YouHuoShop/Static/uploadify/uploadify.css" type="text/css" rel="stylesheet"></link>
	    <script type="text/javascript" charset="utf-8" src="http://localhost/YouHuoShop/Static/ueditor1_4_3/ueditor.config.js"></script>
	    <script type="text/javascript" charset="utf-8" src="http://localhost/YouHuoShop/Static/ueditor1_4_3/ueditor.all.min.js"></script>
	    <script type="text/javascript" charset="utf-8" src="http://localhost/YouHuoShop/Static/ueditor1_4_3/lang/zh-cn/zh-cn.js"></script>
	    <script type="text/javascript">
	    	var getAttrURL='<?php echo U("AjaxGetAttr");?>';
	    </script>
	    <script src="http://localhost/YouHuoShop/Static/Admin/js/goods.js" type="text/javascript" charset="utf-8"></script>	
	    <style type="text/css">
	    	.addPrice{
	    		text-align: right;
	    	}
	    	.imgList ul li{
	    		list-style: none;
	    		float:left;
	    	}
	    	.imgList img{
	    		margin-right: 30px;
	    		margin-bottom: 20px;
	    	}
	    </style>
	</head>
	<body>
		<form action="" method="post">
		<div class="alert alert-success">添加商品</div>
		<!-- 基本信息 -->
		<table class="table table-hover">
			<tr class="active">
			  <th width="150">基本信息</th>
			  <th></th>
			  <th width="450"></th>
			</tr>
			<tr>
				<td style="line-height:40px">商品名称</td>
				<td style="padding-top:13px;padding-bottom:13px;">
					<input name="gname" id="" class="form-control" type="text" placeholder="请输入商品名称" required="" value="">
				</td>
				<td></td>
			</tr>
			<tr >
				<td style="line-height:40px">所属分类</td>
				<td style="padding-top:13px;padding-bottom:13px;">
					<select name="category_cid" id='category' class="form-control">
						<option value="0">请选择</option>
						<?php foreach ($cateData as $k=>$c){?>
							<option value="<?php echo $c['cid'];?>" tpid='<?php echo $c['tpid'];?>'><?php echo $c['_name'];?></option>
						<?php }?>
					</select>
				</td>
				<td></td>
			</tr>
			<tr>
				<td style="line-height:40px">所属品牌</td>
				<td style="padding-top:13px;padding-bottom:13px;">
					<select name="brand_bid" class="form-control">
						<option value="0">请选择</option>
						<?php foreach ($brandData as $k=>$b){?> 
							<option value="<?php echo $b['bid'];?>"><?php echo $b['bname'];?></option>
						<?php }?>	
					</select>
				</td>
				<td></td>
			</tr>
			<tr>
				<td style="line-height:40px">商品标号</td>
				<td style="padding-top:13px;padding-bottom:13px;">
					<input name="gnum" class="form-control" type="text" placeholder="请输入商品标号： " required="" value="">
				</td>
				<td></td>
			</tr>
			<tr>
				<td style="line-height:40px">单位</td>
				<td style="padding-top:13px;padding-bottom:13px;">
					<input id="" name="unit" class="form-control" type="text" placeholder="请输入单位名称： 如 ( 件 ) " required="" value="">
				</td>
				<td></td>
			</tr>
			<tr>
				<td style="line-height:40px">市价场</td>
				<td style="padding-top:13px;padding-bottom:13px;">
					<input name="market_price" id="" class="form-control" type="text" placeholder="请输入市价场" required="" value="">
				</td>
				<td></td>
			</tr>
			<tr>
				<td style="line-height:40px">商城价</td>
				<td style="padding-top:13px;padding-bottom:13px;">
					<input name="shop_price" id="" class="form-control" type="text" placeholder="请输入商城价" required="" value="">
				</td>
				<td></td>
			</tr>
			<tr>
				<td style="line-height:40px">点击量</td>
				<td style="padding-top:13px;padding-bottom:13px;">
					<input id=""  name="click_num" class="form-control" type="text" placeholder="请输入商品库存量" required="" value="">
				</td>
				<td></td>
			</tr>
		</table>
		<!-- 商品属性 -->
		<table id="goodsAttr" class="table table-hover">
			<tr class="active">
			  <th width="150">商品属性</th>
			  <th></th>
			  <th width="450"></th>
			</tr>
		</table>
		<!-- 商品规格 -->
		<table id="goodsSpec" class="table table-hover">
			<tr class="active">
			  <th width="80">商品规格</th>
			  <th width="200"></th>
			  <th width="80"></th>
			  <th width="100"></th>
			  <th width="30"></th>
			</tr>
		</table>
		<!-- 列表图 -->
		<table class="table table-hover">
			<tr class="active">
				<th width="110">列表图</th>
				<th width="300"></th>
				<th width="600"></th>
			</tr>
			<tr>
				<td style="line-height:40px">上传列表图</td>
				<td>
					<input id="list_img_btn" class="upbtn" type="file" multiple="false">
					<label for="">类型: *.jpg,*.png 大小: 2000KB</label>
				</td>
				<td>
	            	<div id="listImgList" class="imgList"><ul></ul></div>
				</td>
			</tr>
		</table>
		<!-- 商品图册 -->
		<table class="table table-hover">
			<tr class="active">
			  <th width="110">商品图册</th>
				<th width="300"></th>
				<th width="600"></th>
			</tr>
			<tr>
				<td style="line-height:40px">上传商品图册</td>
				<td>
					<input id="showImg_btn" class="upbtn" type="file" multiple="true">
					<label for="">类型: *.jpg,*.png 大小: 2000KB</label>
				</td>
				<td>
	            	 <div id="showImgList" class="imgList"><ul></ul></div>
				</td>
			</tr>
		</table>
		<!-- 商品详细 -->
		<table class="table table-hover">
			<tr class="active">
			  <th class="goodsDetails">商品详细</th>
			</tr>
			<tr class="bdtext">
				<td>
					<script id="editor" type="text/plain" name="info" style="width:1024px;height:500px;"></script>
	   				 <script>
	       				 var ue = UE.getEditor('editor');
	   				 </script>
				</td>
			</tr>
		</table>
		<!-- 售后服务 -->
		<!--<table class="table table-hover">
			<tr class="active">
			  <th >售后服务</th>
			</tr>
			<tr>
				<td style="line-height:40px">百度编辑器</td>
			</tr>
		</table>-->
		<input class="btn btn-primary btn-block" type="submit" value=" 添 加 商 品 ">
		</form>
		
		<!--商品列表图上传-->
		<div lab="uploadFile">
	        <script type="text/javascript">
	            $(function() {
	                $('#list_img_btn').uploadify({
	                    'formData'     : {//POST数据
	                        '<?php echo session_name();?>' : '<?php echo session_id();?>',
	                    },
	                    'fileTypeDesc' : '上传文件',//上传描述
	                    'fileTypeExts' : '<?php echo $set['filetype'];?>',
	                    'swf'      : 'http://localhost/YouHuoShop/Static/uploadify/uploadify.swf',
	                    'uploader' : '<?php echo U("listImg");?>',
	                    'buttonText':'选择文件',
	                    'fileSizeLimit' : '2000KB',
	                    'uploadLimit' : 1,//上传文件数
	                    'width':65,
	                    'height':25,
	                    'successTimeout':10,//等待服务器响应时间
	                    'removeTimeout' : 0.2,//成功显示时间
	                    'onUploadSuccess' : function(file, data, response) {
	                        data=$.parseJSON(data);
	                        var imageUrl = data.image?data.url:'http://localhost/YouHuoShop/Static/image/default.png';
	                        var li="<li><img src='"+imageUrl+"' style='width:200px;height:100px;'/>"+
	                      		  "<input type='hidden' name='list_img' value='"+data.path+"'/> </li>";
	                        $("#listImgList ul").prepend(li);
	                        $('#list_img_btn').slideUp().siblings('label').slideUp();
	                    }
	                });
	            });
	           
	        </script>
		</div>
		
		<!--商品图册上传-->
		<div lab="uploadFile">
	        <script type="text/javascript">
	            $(function() {
	                $('#showImg_btn').uploadify({
	                    'formData'     : {//POST数据
	                        '<?php echo session_name();?>' : '<?php echo session_id();?>',
	                    },
	                    'fileTypeDesc' : '上传文件',//上传描述
	                    'fileTypeExts' : '<?php echo $set['filetype'];?>',
	                    'swf'      : 'http://localhost/YouHuoShop/Static/uploadify/uploadify.swf',
	                    'uploader' : '<?php echo U("showImg");?>',
	                    'buttonText':'选择文件',
	                    'fileSizeLimit' : '2000KB',
	                    'uploadLimit' : 10,//上传文件数
	                    'width':65,
	                    'height':25,
	                    'successTimeout':10,//等待服务器响应时间
	                    'removeTimeout' : 0.2,//成功显示时间
	                    'onUploadSuccess' : function(file, data, response) {
	                        data=$.parseJSON(data);
	                        var imageUrl = data.image?data.url:'http://localhost/YouHuoShop/Static/image/default.png';
	                        var li="<li><img src='"+imageUrl+"' style='width:200px;height:100px;'/>"+
	                      		  "<input type='hidden' name='showImg[]' value='"+data.path+"'/> </li>";
	                        $("#showImgList ul").prepend(li);
	                    }
	                });
	            });
	        </script>
		</div>
	
	</body>
</html>
